<%@page import="org.apache.commons.lang.StringUtils"%> 
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	request.setAttribute("path", path);
	String thispage = request.getParameter("page");
	if(StringUtils.isEmpty(thispage)){
		thispage = "1";
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="ThemeBucket">
  <link rel="shortcut icon" href="#" type="image/png">

  <title>激流文件系统</title>

  <!--dynamic table-->
  <link href="${path}/style/def/js/advanced-datatable/css/demo_page.css" rel="stylesheet" />
  <link href="${path}/style/def/js/advanced-datatable/css/demo_table.css" rel="stylesheet" />
  <link href="${path}/style/def/js/data-tables/DT_bootstrap.css"  rel="stylesheet"  />

  <link href="${path}/style/def/css/style.css" rel="stylesheet">
  <link href="${path}/style/def/css/style-responsive.css" rel="stylesheet">

  <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
  <script src="js/html5shiv.js"></script>
  <script src="js/respond.min.js"></script>
  <![endif]-->
</head>

<body>
   
        <div class="wrapper">
        <div class="row">
        <div class="col-sm-12">
        <section class="panel">
        <header class="panel-heading">
           	角色管理 
        </header>
        <form name="searchForm" method="post" class="form-search" action="" id="searchForm">
        <div class="panel-body">
        
        <div class="form-inline pull-left">
                          		 	 <!-- 操作按钮 -->
            <a class="btn btn-primary  btn-sm" href="${path}/jsp/role/role_edit.jsp">添加</a>
            <a class="btn btn-danger  btn-sm" href="javascript:;" onclick="deleteCheck()">删除</a>
        </div>
        
        <div class="form-inline pull-right">
                          			  <!-- 查询条件 -->
	      <div class="form-group">
          	<input type="text" name="name" class="form-control"  placeholder="请输入角色名">
          </div> 
           	<button type="button" class="btn btn-success" id="searchBtn"><i class=" icon-search"></i>搜索</button>
          </div>
        
        
        <div class="adv-table">
     	<table id="table_role" class="table table-striped table-advance table-hover" style="margin-bottom:0px;">
        	<thead>
        	<tr>
            	<th style="width: 15px;"><input role="checkbox" id="cb_grid-table" class="cbox" type="checkbox"></th>
            	<th rowName="name" orderName="name:DESC" title='角色名'>角色名</th>
            	<th rowName="description" orderName="description:DESC" title='角色名'>描述</th>
            	<th width="200px"><i class=" icon-edit"></i>操作</th>
       		</tr>
        	</thead>
        <tbody> 
        </tbody>
     </table>
     
       <jsp:include page="/jsp/portal/page.jsp" />
       </form>
        </div>
        </div>
        </section>
        </div>
        </div>
        
        </div> 

<!-- Placed js at the end of the document so the pages load faster -->
<script src="${path}/style/def/js/jquery-1.10.2.min.js"></script>
<script src="${path}/style/def/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="${path}/style/def/js/jquery-migrate-1.2.1.min.js"></script>
<script src="${path}/style/def/js/bootstrap.min.js"></script>
<script src="${path}/style/def/js/modernizr.min.js"></script>
<script src="${path}/style/def/js/jquery.nicescroll.js"></script> 
<!--common scripts for all pages-->
<script src="${path}/style/def/js/scripts.js"></script>

<script src="${path}/style/def/js/respond.min.js"></script>
<script src="${path}/style/authory/js/bootbox.min.js"></script> 
<script src="${path}/style/authory/js/jquery.page.js"></script>
<script src="${path}/style/authory/js/list.js"></script>
<script src="${path}/style/authory/js/list_ajax.js"></script>
<script src="${path}/style/authory/js/common-scripts.js"></script>
<script src="${path}/style/authory/js/common.js"></script>
<script src="${path}/style/authory/js/jquery.scrollTo.min.js"></script> 

<script class="include" type="text/javascript" src="${path}/style/authory/js/jquery.dcjqaccordion.2.7.js"></script>

<script type="text/javascript">
var page = '<%=thispage%>';
jQuery.component({
});
var operates = {
		  isOper:true,
		  operHtml:"<a href=\"javascript:;\" class=\"btn btn-xs btn-info\" onclick=\"detail('#id#')\"><i class=\"icon-check\"></i> 详情</a>&nbsp;<a href=\"javascript:;\" class=\"btn btn-xs btn-warning\" onclick=\"edit('#id#')\"><i class=\"icon-edit\"></i> 修改</a>&nbsp;<a href=\"javascript:;\" class=\"btn btn-xs btn-danger\" onclick=\"deleteByPk('#id#')\"><i class=\"icon-trash\"></i> 删除</a>"
}

var options = {
		tableId:'table_role',
		url:'${path}/roleMng/list.do',
		operates:operates,
		formId:'searchForm',
		searchId:'searchBtn',
		selectBox:1,
		page:page,
		primaryKey:'id',
		dataItems:{
		}
	};
	jQuery.page( options );
	
	
	function detail(id){
		var thispage = $("#searchForm input[name='pageNo']").val(); 
		javascript:window.location.href='${path}/jsp/role/role_detail.jsp?pk='+id+'&page='+thispage;
	}
		
		
	function edit(id){
		var thispage = $("#searchForm input[name='pageNo']").val();
		javascript:window.location.href='${path}/jsp/role/role_edit.jsp?pk='+id+'&page='+thispage;
	}
	
	
	 function deleteByPk(pk){
	       bootbox.confirm({
			   message: "确认删除?", 
			   callback: function(result){ 
			   		if(result){
			    	    	jQuery.ajax({
					  			url : "${path}/role/deleteByPk.do",
					  			type : "post",
					  			data : {pks:pk},
					  			success : function(result) {
					  				if (result == "success") {
					  					bootbox.alert( '删除成功'); 
					  					jQuery.page( options );
					  				} else{
					  					bootbox.alert( '删除失败'); 
					  				}
					  			},
					  			error : function(result) {
					  				bootbox.alert( '删除失败'); 
					  			}
					
					  		});
			    	   }
			    	}
			  })  
	  	}
	
	

</script>



</body>
</html>
